// spu管理的api文件
import request from '@/utils/request'

// 获取spu数据的数据接口
export const getSpuList = (page, limit, category3Id) => {
  return request({
    url: `/admin/product/${page}/${limit}`,
    method: 'get',
    params: { category3Id }
  })
}

// 获取spu信息
export const getSpuItem = (spuId) => {
  return request({
    url: `/admin/product/getSpuById/${spuId}`,
    method: 'get'
  })
}

// 获取品牌信息
export const getSpuTrade = () => {
  return request({
    url: `/admin/product/baseTrademark/getTrademarkList`,
    method: 'get'
  })
}

// 获取spu图片信息
export const getSpuImage = (spuId) => {
  return request({
    url: `/admin/product/spuImageList/${spuId}`,
    method: 'get'
  })
}

// 获取spu销售信息
export const getSpuSale = () => {
  return request({
    url: `/admin/product/baseSaleAttrList`,
    method: 'get'
  })
}

// 添加spu信息
export const addSpu = (data) => {
  return request({
    url: `/admin/product/saveSpuInfo`,
    method: 'post',
    data
  })
}

// 更新spu信息
export const editSpu = (data) => {
  return request({
    url: `/admin/product/updateSpuInfo`,
    method: 'post',
    data
  })
}
